package com.jialanmo.zhihudaily;

import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;

public final class RxBus {
    private final Subject<Object, Object> bus;

    public RxBus() {
        bus = PublishSubject.create();
    }

    public void send(Object o) {
        bus.onNext(o);
    }

    public <T> Observable<T> toObservable(Class<T> eventType) {
        return bus.ofType(eventType);
    }
}
